package net.gyapp.markim.module.mine;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import com.easyder.wrapper.base.view.WrapperSwipeActivity;
import com.easyder.wrapper.core.model.BaseVo;

import net.gyapp.markim.R;
import net.gyapp.markim.module.basic.base.CommonPresenter;

import butterknife.BindView;
import butterknife.OnClick;
import me.winds.widget.usage.TitleView;

/**
 * Auther:  winds
 * Email:   heardown@163.com
 * Date:    2018/8/5.
 * Desc:
 */
public class ScanResultActivity extends WrapperSwipeActivity<CommonPresenter> {
    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.btn_confirm)
    Button btnConfirm;

    String result;

    public static Intent getIntent(Context context, String result) {
        return new Intent(context, ScanResultActivity.class).putExtra("result", result);
    }

    @Override
    protected int getViewLayout() {
        return R.layout.activity_scan_result;
    }

    @Override
    protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
        titleView.setCenterText("扫描结果");
        result = intent.getStringExtra("result");
        tvContent.setText(result);
    }

    @Override
    protected void loadData(Bundle savedInstanceState, Intent intent) {

    }

    @Override
    public void showContentView(String url, BaseVo dataVo) {

    }


    @OnClick(R.id.btn_confirm)
    public void onViewClicked() {
        ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        cm.setPrimaryClip(ClipData.newPlainText(null, result));
        showToast("复制成功");
    }
}
